import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import {RouterModule, Routes} from '@angular/router';
import {PrimeNgModule} from '../prime-ng.module';
import {SharedModule} from '../shared/shared.module';
import {UserIndexComponent} from './component/user-index.component';
import {UserDialogComponent} from './component/user-dialog.component';
import {ContainerShowComponent} from '../shared/component/container-show.component';
import {EntityService} from '../shared/services/entity.service';
import {RoleIndexComponent} from './component/role-index.component';
import {FunctionIndexComponent} from './component/function-index.component';
import {UnitIndexComponent} from './component/unit-index.component';
import {MenuIndexComponent} from './component/menu-index.component';
import {MarkdownModule} from 'angular2-markdown';
import {RoleAddEditComponent} from './component/role-add-edit.component';
import {MenuListComponent} from './component/menu-list.component';
import {MenuAddEditComponent} from './component/menu-add-edit.component';

const indexArr = [UserIndexComponent, RoleIndexComponent, FunctionIndexComponent, UnitIndexComponent,
  MenuIndexComponent, MenuListComponent, MenuAddEditComponent

];
const dialogArr = [UserDialogComponent, RoleAddEditComponent, MenuAddEditComponent];

export const routes: Routes = [
  {
    path: '',
    component: ContainerShowComponent,
    children: [
      {path: 'user', component: UserIndexComponent},
      {path: 'role', component: RoleIndexComponent},
      {path: 'function', component: FunctionIndexComponent},
      {path: 'module', component: MenuIndexComponent},
      {path: 'unit', component: UnitIndexComponent},
    ]
  },
];

@NgModule({
  imports: [
    CommonModule,
    RouterModule.forChild(routes),
    PrimeNgModule,
    SharedModule,
    MarkdownModule.forRoot(),
  ],
  entryComponents: [ dialogArr ],
  declarations: [indexArr, dialogArr],
  providers: [ EntityService ]
})
export class SystemManageModule { }
